package com.haoxi.gateway.smgpmsg;

import com.haoxi.gateway.util.TypeConvert;




public class SMGPDeliverRespMessage extends SMGPMessage
{

    private StringBuffer strBuf;

    public SMGPDeliverRespMessage(byte msg_Id[], int status)
        throws IllegalArgumentException
    {
        if(msg_Id.length > 10)
            throw new IllegalArgumentException("The parameter of response message for answering the deliver message sent by SMC is wrong:msg_Id length is larger than 10");
        if(status < 0)
        {
            throw new IllegalArgumentException("The parameter of response message for answering the deliver message sent by SMC is wrong:result[".concat(String.valueOf(status)).concat("]"));
        } else
        {
            int len = 26;
            buf = new byte[len];
            TypeConvert.int2byte(len, buf, 0);
            TypeConvert.int2byte(SMGPCommon.SMGP_DELIVER_RESP, buf, 4);
            System.arraycopy(msg_Id, 0, buf, 12, msg_Id.length);
            TypeConvert.int2byte(status, buf, 22);
            strBuf = new StringBuffer(100);
            strBuf.append(",status=".concat(String.valueOf(String.valueOf(status))));
            return;
        }
    }

    public String toString()
    {
        StringBuffer outStr = new StringBuffer(100);
        outStr.append("SMGPDeliverRespMessage:");
        outStr.append(",Sequence_Id=".concat(String.valueOf(String.valueOf(getSequenceId()))));
        if(strBuf != null)
            outStr.append(strBuf.toString());
        return outStr.toString();
    }

    public int getRequestId()
    {
        return SMGPCommon.SMGP_DELIVER_RESP;
    }
}
